+Wed May 15 17:12:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c: Special case menu items to
+ pop down on motion. (#75961)
+
+ * tests/testgtk.c (create_item_factory): Add tooltips
+ to the File menu.
+
+ * gtk/gtkentry.c (update_im_cursor_location): Fix
+ cursor locations passed to the IM context.
+ (#80027, Yao Zhang)
+
Wed May 15 16:52:57 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c: Update from contents of size entry
+Wed May 15 17:12:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c: Special case menu items to
+ pop down on motion. (#75961)
+
+ * tests/testgtk.c (create_item_factory): Add tooltips
+ to the File menu.
+
+ * gtk/gtkentry.c (update_im_cursor_location): Fix
+ cursor locations passed to the IM context.
+ (#80027, Yao Zhang)
+
Wed May 15 16:52:57 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c: Update from contents of size entry
+Wed May 15 17:12:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c: Special case menu items to
+ pop down on motion. (#75961)
+
+ * tests/testgtk.c (create_item_factory): Add tooltips
+ to the File menu.
+
+ * gtk/gtkentry.c (update_im_cursor_location): Fix
+ cursor locations passed to the IM context.
+ (#80027, Yao Zhang)
+
Wed May 15 16:52:57 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c: Update from contents of size entry
+Wed May 15 17:12:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c: Special case menu items to
+ pop down on motion. (#75961)
+
+ * tests/testgtk.c (create_item_factory): Add tooltips
+ to the File menu.
+
+ * gtk/gtkentry.c (update_im_cursor_location): Fix
+ cursor locations passed to the IM context.
+ (#80027, Yao Zhang)
+
Wed May 15 16:52:57 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c: Update from contents of size entry
+Wed May 15 17:12:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c: Special case menu items to
+ pop down on motion. (#75961)
+
+ * tests/testgtk.c (create_item_factory): Add tooltips
+ to the File menu.
+
+ * gtk/gtkentry.c (update_im_cursor_location): Fix
+ cursor locations passed to the IM context.
+ (#80027, Yao Zhang)
+
Wed May 15 16:52:57 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c: Update from contents of size entry
+Wed May 15 17:12:50 2002 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktooltips.c: Special case menu items to
+ pop down on motion. (#75961)
+
+ * tests/testgtk.c (create_item_factory): Add tooltips
+ to the File menu.
+
+ * gtk/gtkentry.c (update_im_cursor_location): Fix
+ cursor locations passed to the IM context.
+ (#80027, Yao Zhang)
+
Wed May 15 16:52:57 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfontsel.c: Update from contents of size entry
GdkRectangle area;
gint strong_x;
gint strong_xoffset;
- gint x, y, area_width, area_height;
+ gint area_width, area_height;
gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &strong_x, NULL)
;
- get_text_area_size (entry, &x, &y, &area_width, &area_height);
+ get_text_area_size (entry, NULL, NULL, &area_width, &area_height);
strong_xoffset = strong_x - entry->scroll_offset;
if (strong_xoffset < 0)
{
strong_xoffset = area_width;
}
- area.x = x + strong_xoffset;
- area.y = y + area_height;
- area.width = area_width;
+ area.x = strong_xoffset;
+ area.y = 0;
+ area.width = 0;
area.height = area_height;
gtk_im_context_set_cursor_location (entry->im_context, &area);
#include "gtklabel.h"
#include "gtkmain.h"
+#include "gtkmenuitem.h"
#include "gtkwidget.h"
#include "gtkwindow.h"
#include "gtksignal.h"
}
}
+static void
+gtk_tooltips_start_delay (GtkTooltips *tooltips,
+ GtkWidget *widget)
+{
+ GtkTooltipsData *old_tips_data;
+
+ old_tips_data = tooltips->active_tips_data;
+ if (tooltips->enabled &&
+ (!old_tips_data || old_tips_data->widget != widget))
+ {
+ guint delay;
+
+ gtk_tooltips_set_active_widget (tooltips, widget);
+
+ if (tooltips->use_sticky_delay &&
+ gtk_tooltips_recently_shown (tooltips))
+ delay = STICKY_DELAY;
+ else
+ delay = tooltips->delay;
+ tooltips->timer_tag = gtk_timeout_add (delay,
+ gtk_tooltips_timeout,
+ (gpointer) tooltips);
+ }
+}
+
static void
gtk_tooltips_event_handler (GtkWidget *widget,
GdkEvent *event)
switch (event->type)
{
- case GDK_MOTION_NOTIFY:
case GDK_EXPOSE:
/* do nothing */
break;
-
case GDK_ENTER_NOTIFY:
- old_tips_data = tooltips->active_tips_data;
- if (tooltips->enabled &&
- (!old_tips_data || old_tips_data->widget != widget))
- {
- guint delay;
-
- gtk_tooltips_set_active_widget (tooltips, widget);
-
- if (tooltips->use_sticky_delay &&
- gtk_tooltips_recently_shown (tooltips))
- delay = STICKY_DELAY;
- else
- delay = tooltips->delay;
- tooltips->timer_tag = gtk_timeout_add (delay,
- gtk_tooltips_timeout,
- (gpointer) tooltips);
- }
+ gtk_tooltips_start_delay (tooltips, widget);
break;
case GDK_LEAVE_NOTIFY:
}
break;
+ case GDK_MOTION_NOTIFY:
+ /* Handle menu items specially ... pend popup for each motion
+ * on other widgets, we ignore motion.
+ */
+ if (GTK_IS_MENU_ITEM (widget))
+ {
+ gtk_tooltips_set_active_widget (tooltips, NULL);
+ gtk_tooltips_start_delay (tooltips, widget);
+ break;
+ }
+ break; /* ignore */
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
case GDK_KEY_PRESS:
GtkWidget *button;
GtkAccelGroup *accel_group;
GtkItemFactory *item_factory;
+ GtkTooltips *tooltips;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
"/Preferences/Shape/Oval")),
TRUE);
+ /* Test how tooltips (ugh) work on menu items
+ */
+ tooltips = gtk_tooltips_new ();
+ g_object_ref (tooltips);
+ gtk_object_sink (GTK_OBJECT (tooltips));
+ g_object_set_data_full (G_OBJECT (window), "testgtk-tooltips",
+ tooltips, (GDestroyNotify)g_object_unref);
+
+ gtk_tooltips_set_tip (tooltips, gtk_item_factory_get_item (item_factory, "/File/New"),
+ "Create a new file", NULL);
+ gtk_tooltips_set_tip (tooltips, gtk_item_factory_get_item (item_factory, "/File/Open"),
+ "Open a file", NULL);
+ gtk_tooltips_set_tip (tooltips, gtk_item_factory_get_item (item_factory, "/File/Save"),
+ "Safe file", NULL);
+ gtk_tooltips_set_tip (tooltips, gtk_item_factory_get_item (item_factory, "/File/Save As..."),
+ "Save under a new name", NULL);
+
box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);